# 读取数据
import pandas as pd
data = pd.read_excel('销售表1.xlsx', sheet_name=0)
print(data)

# 检测缺失值
print(data.isna().sum())

# 删除缺失值
data1 = data.dropna(how='any')
print(data1)

# 填充缺失值
data2 = data.fillna(value=0)
print(data2)

data3 = data.fillna(value={'成本价': 16.0, '销售价': 124.98})
print(data3)

data4 = data.sort_values(by=['产品', '成本价', '销售价'], ascending=True, na_position='last').ffill()
print(data4)
